import request from "/@/utils/request"

export function getPage(query?: Object) {
  return request({
    url: '/bizs/order/page',
    method: 'get',
    params: query
  })
}

export function getList(query?: Object) {
  return request({
    url: '/bizs/order/list',
    method: 'get',
    params: query
  })
}

export function getObj(id?: string) {
  return request({
    url: '/bizs/order/' + id,
    method: 'get'
  })
}

export function addObj(obj?: Object) {
  return request({
    url: '/bizs/order',
    method: 'post',
    data: obj
  })
}

export function putObj(obj?: Object) {
  return request({
    url: '/bizs/order',
    method: 'put',
    data: obj
  })
}

export function delObjs(ids?: Object) {
  return request({
    url: '/bizs/order',
    method: 'delete',
    data: ids
  })
}

// 关闭订单
export const closeOrderAPI = (id:string | number)=>{
  return request({
    url:`/admin/order/${id}/close`,
    method:"PUT",
  })
}

export interface ChangePriceParams{
  reduceAmount:number | string
}

// 修改价格
export const changePriceAPI = (id:string | number,data:ChangePriceParams) =>{
  return request({
    url:`/admin/order/${id}/updateReduceAmount`,
    method:"PUT",
    params:data
  })
}

// 订单发货

export const orderdeliveryAPI = (id:string,data:{deliveryType:number,logisticsNo:string})=>{
  return request({
    url:`/admin/order/${id}/delivery`,
    method:"PUT",
    data
  })
}